package com.chinemit.cui.components.itemrenderer
{
	import com.chinemit.cui.components.core.CUIComponent;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	
	public class ItemRendererBase extends CUIComponent
	{
		protected var _itemContainer:DisplayObject;
		protected var _data:*;
		public function ItemRendererBase(_data:*=null,_w:Number=100,_h:Number=100)
		{
			super();
			this.graphics.beginFill(Math.random()*0xffffff,0);
			this.graphics.drawRect(0,0,_w,_h);
			this.graphics.endFill();
			data = _data;
		}

		public function get data():*
		{
			return _data;
		}

		public function set data(value:*):void
		{
			_data = value;
			if(_data){
				
			}
		}
		
		public function get itemContainer():DisplayObject
		{
			return _itemContainer;
		}
		
		public function set itemContainer(value:DisplayObject):void
		{
			_itemContainer = value;
			if(_itemContainer){
				this._itemContainer.x  = (this.width-this._itemContainer.width)*0.5;
				this._itemContainer.y  = (this.height-this._itemContainer.height)*0.5;
				this.addChild(_itemContainer);
			}
		}
	}
}